export const addRules = {
  departId: [
    {
      type: 'number',
      required: true,
      message: '请选择部门',
      trigger: 'change'
    }
  ],
  roleList: [
    {
      type: 'array',
      required: true,
      message: '请选择角色',
      trigger: 'blur'
    }
  ],
  userName: [
    {
      required: true,
      message: '请输入用户名称',
      trigger: 'blur'
    }
  ],
  nickName: [
    {
      required: true,
      message: '请输入用户昵称',
      trigger: 'blur'
    }
  ],
  phone: [
    {
      required: true,
      message: '请输入手机号码',
      trigger: 'blur'
    }
  ],
  password: [
    {
      required: true,
      message: '请输入密码',
      trigger: 'blur'
    }
  ],
  email: [
    {
      required: true,
      message: '请输入邮箱',
      trigger: 'blur'
    }
  ],
  enabled: [
    {
      type: 'number',
      required: true,
      message: '请选择是否可用',
      trigger: 'change'
    }
  ]
};

export const tableColumns = [
  {
    title: '所属部门',
    dataIndex: 'departInfo',
    customRender: (row) => {
      console.log(row)
      return row.record.departInfo.departName
    }
  },
  {
    title: '用户名称',
    dataIndex: 'userName'
  },
  {
    title: '用户昵称',
    dataIndex: 'nickName'
  },
  {
    title: '手机号码',
    dataIndex: 'phone'
  },
  {
    title: '性别',
    dataIndex: 'gender',
    customRender: (row) => {
      if (row.record.gender === '1') {
        return '男'
      } else {
        return '女'
      }
    }
  },
  {
    title: '是否可用',
    dataIndex: 'enabled',
    customRender: (row) => {
      if (row.record.enabled) {
        return '是'
      } else {
        return '否'
      }
    }
  },
  {
    title: '更新时间',
    dataIndex: 'updateTime'
  },
  {
    title: '操作栏',
    key: 'operation',
    align: 'center',
    slots: {
      customRender: 'operation'
    },
    width: '120px'
  }
]